package com.ellricky.baselib.ui.visit;


import android.widget.TextView;

import com.ellricky.baselib.R;
import com.ellricky.baselib.entity.visit.VisitDetailEntity;
import com.ellricky.baselib.http.callback.ECallback;
import com.ellricky.baselib.ui.base.BaseDetailActivity;
import com.ellricky.baselib.widget.DetailItemView;

import static com.ellricky.baselib.http.Api.API_VISIT_DETAIL;

public class VisitDetailActivity extends BaseDetailActivity {

    private TextView tvName;
    private DetailItemView tvWish;
    private DetailItemView tvCharacter;
    private DetailItemView tvLove;
    private DetailItemView tvSpecial;
    private DetailItemView tvRemark;

    @Override
    public int getContentLayout() {
        return R.layout.base_activity_visit_detail;
    }

    @Override
    public void initUIView() {
        super.initUIView();
        mTvTitle.setText(R.string.base_visit_detail);

        tvName = findViewById(R.id.tvName);
        tvWish = findViewById(R.id.tvWish);
        tvCharacter = findViewById(R.id.tvCharacter);
        tvLove = findViewById(R.id.tvLove);
        tvSpecial = findViewById(R.id.tvSpecial);
        tvRemark = findViewById(R.id.tvRemark);

        loadDetail(id);
    }


    private void loadDetail(String id) {
        mPresenter.loadDetail(
                API_VISIT_DETAIL, id, new ECallback<VisitDetailEntity>(this) {
                    @Override
                    public void onSuccess(VisitDetailEntity data, String msg) {
                        tvName.setText(data.getName());

                        tvWish.setValue(data.getBackAnswer());
                        tvCharacter.setValue(data.getChildNature());
                        tvLove.setValue(data.getLoveInfo());
                        tvSpecial.setValue(data.getSpecialRequired());
                        tvRemark.setValue(data.getBackInfo());
                    }
                });
    }


}